import { createStore } from 'vuex'
import actions from '@/qiankun/actions'

const { setGlobalState } = actions
export default createStore({
  state: {
    GlobalData: {
      name: 'default',
      age: 'default'
    }
  },
  mutations: {
    getGlobalData (state, value) {
      state.GlobalData = value
    }
  },
  actions: {
    initGlobalData ({ state }) {
      return setGlobalState(state.GlobalData)
    },
    setGlobalData (store, payload) {
      return setGlobalState(payload)
    }
  }
})
